package com.nulldev.util.java.scripting.nscript;

public final class nScriptSecurity {
	public static enum Permissions {
        INTERNET("inet", false), 
        GET_SYSTEM("sys_info", true),
        ALTER_CLASSPATH("updateclasspath", true);
        
        private String permID;
        private boolean critical;

        Permissions(String id, boolean critical) {
            this.permID = id;
            this.critical = critical;
        }
        
        public String getPermissionID() {
            return permID;
        }

        public static Permissions get(String string) {
            for(Permissions p : values()) {
                if (p.permID.equals(string)) {
                    return p;
                }
            }
            return null;
        }

        public boolean isCritical() {
            return critical;
        }
    }
    
    
    public static class ScriptSecurityException extends Exception {

        private static final long serialVersionUID = 525368989059033003L;

        public ScriptSecurityException(final Throwable e) {
            super(e);
        }

        public ScriptSecurityException(final String string) {
            super(string);
        }
    }
}
